from urllib.error import URLError

from core import Request
from time import sleep


def start():
    surl = input('请输入网址：')
    keyword = input('请输入关键字')
    deep_level = input('请输入嵌套层次')
    run(surl, keyword, deep_level)


def run(surl, keyword, deep):
    pass


# 获取接口数据
def GetApiData(surl, params):
    retdata = None
    try:
        resp = Request.Post(surl, params)
        retdata = resp.content
    except URLError as e:
        pass
    return retdata


#批量获取接口数据
def BatchGetApiData(url, params, times, freq=1):
    retDatas = []
    for i in range(0, times):
        line = GetApiData(url, params)
        retDatas.append(line)
    return retDatas